import pytest
import requests

from api.ihrmEmpApi import IhrmEmpApi
from commen.assert_tools import assert_methods
from commen.db_tools import DBUtil
from commen.get_header_tools import get_header
from config import TEL


class TestQueryEmp:

    def setup_class(self):
        self.header = get_header()

    def setup(self):
        DBUtil.idu_methods(f"delete from bs_user where mobile = '{TEL}';")
        DBUtil.idu_methods(f"insert into bs_user (username,mobile,workNumber)values('zs4','TEL','9527');")

    def teardown(self):
        DBUtil.idu_methods(f"delete from bs_user where mobile = '{TEL}';")

    def test_query(self):
        emp_id='007'

        resp = IhrmEmpApi.query_emp(emp_id,self.header)
        print(resp.json())
        assert_methods(resp, 200, True, 10000, "操作成功")